

from lib.umqtt.simple import MQTTClient


# ===添加下面参数===
USER = "admin"
PWD = "password"

# ……省略……

# 修改main函数，添加port、USER、PWD参数
def ccmqtt(server="localhost", port=61613):
    c = MQTTClient("umqtt_client", server, port, USER, PWD)
    print(c) # 打印信息用，可加可不加
    # ……省略……

# ……省略……
#
# if __name__ == "__main__":
#         ccmqtt("192.168.10.70") # 修改为相应的MQTT服务器地址